﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Threading;
using CourseUtils;


namespace Fibonacci
{
    class program
    {
        static ulong fibonacci(int n)
        {
            if (n == 0 || n == 1)
                return (ulong)n;
            else
                return fibonacci(n - 1) + fibonacci(n - 2);
        }
        class Program
        {
            static void Main(string[] args)
            {
                ulong result;
                int number;
                
                //Console.WriteLine("Введите целое число:");
                number = CourseUtils.IOHelpers.ReadIntFromConsole("Введите целое число");
//-------------------
        Stopwatch stopWatch = new Stopwatch();
        stopWatch.Start();
//-----------------
                result = fibonacci(number);
//===================
       

        // Get the elapsed time as a TimeSpan value.
        TimeSpan ts = stopWatch.Elapsed;

        // Format and display the TimeSpan value.
        string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
            ts.Hours, ts.Minutes, ts.Seconds,
            ts.Milliseconds / 10);
//===================
                Console.WriteLine("Число Фибоначчи = {0}\n", result);
        Console.WriteLine("RunTime " + elapsedTime);
                Console.ReadKey();
            }
        }
    }
}
